UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EcLQQBX4NM6tUvV+0pGjmBnVmMcQtZ1mQeSFWgXxAHA=' 
WHERE 
  key_id = '17db38bc134be66ec27e0f4127a6cf42254e0dbcbece801127dbedc1aa033214' 
  AND (
    token = 'EcLQQBX4NM6tUvV+0pGjmBnVmMcQtZ1mQeSFWgXxAHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031