UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YjNK3FnH6DFxZS8rI6ahJJ3oMD8P7e9ZCZp+M8r4zSo=' 
WHERE 
  key_id = 'b3f43bf20ed0f0386242844527c1a31244466032c7cbd6509cdd59c0fe94d591' 
  AND (
    token = 'YjNK3FnH6DFxZS8rI6ahJJ3oMD8P7e9ZCZp+M8r4zSo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042