UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DrdT401QfDmxXlCSGA+u/JlrheZgKR7vycHej9bFEtE=' 
WHERE 
  key_id = '86285e759e38e2be748475dbbfc30c96b83acb3bda7f851d34a9750d422ce885' 
  AND (
    token = 'DrdT401QfDmxXlCSGA+u/JlrheZgKR7vycHej9bFEtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030