UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AVh6FfwDw/bp2Vvf/bKPFxxDVNRJ3SNPFeeOfHPFrPY=' 
WHERE 
  key_id = '293bd6310333d4098178752af55e38756653d9e2de9c32149a5a3267bd3fe92e' 
  AND (
    token = 'AVh6FfwDw/bp2Vvf/bKPFxxDVNRJ3SNPFeeOfHPFrPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047