UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S3CMN/NErBu3vqcdVQq28+IhL/MM+xY2Q0PjjPU9mfM=' 
WHERE 
  key_id = '85d2775dbd42d7931847037ee2e190e431c8618dfced2c790d01f322e7056e43' 
  AND (
    token = 'S3CMN/NErBu3vqcdVQq28+IhL/MM+xY2Q0PjjPU9mfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029