UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SJGV4Uc0RT3adTzgOo8aE3kec8lhpwX8L4ZqwIbDETE=' 
WHERE 
  key_id = '11dd292e124569d4a561991ab6a905c84759e81a733f92ecce95963877a3f479' 
  AND (
    token = 'SJGV4Uc0RT3adTzgOo8aE3kec8lhpwX8L4ZqwIbDETE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045