UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BsqiQatPQpX+MdJ3QLAg/8PXfd2PgUmkoNLiUSv2Naw=' 
WHERE 
  key_id = 'ddfb1c29c64d2dfe9b35480848ec4fbe9e9cf08749516130500d875d8e6dc782' 
  AND (
    token = 'BsqiQatPQpX+MdJ3QLAg/8PXfd2PgUmkoNLiUSv2Naw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036