UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ljPOJAc5ixxbFUuTts5I+RPiu/Q3sUhp+CCF8pzPneQ=' 
WHERE 
  key_id = '44d1fc603b031080d8d4c064d2a7ca967a886e3e63cc6b85749b734d2f45feda' 
  AND (
    token = 'ljPOJAc5ixxbFUuTts5I+RPiu/Q3sUhp+CCF8pzPneQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032