UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q3DGyZi+D02njcsSpMS7u6eNWLP5q337pta7EEBCPVM=' 
WHERE 
  key_id = '1388cbe3a718a6143595ef9cff68502016908a2ad7fa48fcdc06830f54e02cf8' 
  AND (
    token = 'q3DGyZi+D02njcsSpMS7u6eNWLP5q337pta7EEBCPVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045