UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rU4qH0FE9ta/mGcIWCp7WRGt4bUn1ugzmBRZkEV+duU=' 
WHERE 
  key_id = '0f5012c6b8c6f2f28b88105000ea5476291ff48215a42f2fa70c0a0547e7fa57' 
  AND (
    token = 'rU4qH0FE9ta/mGcIWCp7WRGt4bUn1ugzmBRZkEV+duU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019