UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ic16QvRFBQBt3TawkfOGT7Bx2qx+uzFX2suYtaO2Yvk=' 
WHERE 
  key_id = '96faa0035e50a108f267e882dba07299abd8b0e675d27e7b752b236d0bf7206d' 
  AND (
    token = 'ic16QvRFBQBt3TawkfOGT7Bx2qx+uzFX2suYtaO2Yvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034