UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'syrXRbyMwIoqGJPbWOZhMw/L21uUemctP2nviECDZwc=' 
WHERE 
  key_id = '57bd39f848311e3582d76319a5ca47438da883a0d128e6b25fc0f7650af9aa1f' 
  AND (
    token = 'syrXRbyMwIoqGJPbWOZhMw/L21uUemctP2nviECDZwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038