UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oSqvBsyihFB8+DcuKRdtpAJ2Z+NWIPjM9GbMWOHq0bE=' 
WHERE 
  key_id = 'a6a23173accf2b9603388728994cda8c95086e6fa369a11fbc3f1c82bfd8dfae' 
  AND (
    token = 'oSqvBsyihFB8+DcuKRdtpAJ2Z+NWIPjM9GbMWOHq0bE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044