UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aL7LlrAO0umP2PXAxuHR8juw7dIaYci4+2+GpTey1NY=' 
WHERE 
  key_id = '3d00e1e2ee4a82565cf0f09b6ad86643710cfe40fe0ab2d5597287e2e27af880' 
  AND (
    token = 'aL7LlrAO0umP2PXAxuHR8juw7dIaYci4+2+GpTey1NY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041