UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PyU2VE0KCgJ+7wf+SLpCBC2VM2zS6x2JECdhNUrPHP4=' 
WHERE 
  key_id = '8d1e9166da5b9a371f5b6e66d3feaedfda51ffe0c3ed05d5793471dfd6402e47' 
  AND (
    token = 'PyU2VE0KCgJ+7wf+SLpCBC2VM2zS6x2JECdhNUrPHP4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030