UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NWs6pCOOGaPLG/hgKkZhcxw33TK+HsB7dzQXdFxH8ks=' 
WHERE 
  key_id = '1f8d68dce29039636c281b9eaff7614629f942a02a0a62708210dd86814fc2d4' 
  AND (
    token = 'NWs6pCOOGaPLG/hgKkZhcxw33TK+HsB7dzQXdFxH8ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038