UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DRuRvze0TJ7+UwpBIaf3kKQN+zhAFuXMPg35Csyalrk=' 
WHERE 
  key_id = 'a20976188f5052e2b4a7f2519eb7628f971509aad2049868de06cc93d9dc2ab1' 
  AND (
    token = 'DRuRvze0TJ7+UwpBIaf3kKQN+zhAFuXMPg35Csyalrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043