UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bKmw00C6LL0wDUlfkfuM3enPCXhCGrjV+0BuzgB+zeU=' 
WHERE 
  key_id = '8a6001286d3af13d9c2a6140cb94e3eaba1f8482a9c3467a275cd6e2b7e8082a' 
  AND (
    token = 'bKmw00C6LL0wDUlfkfuM3enPCXhCGrjV+0BuzgB+zeU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040