UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CfPDa3lsWvcmg1wSKKNtqqBp3TkDk/5r7knzrissQNE=' 
WHERE 
  key_id = '8d0614eab5f33d1438f3df171baa8e09fb0780e13593f1ab05236dab56baac6e' 
  AND (
    token = 'CfPDa3lsWvcmg1wSKKNtqqBp3TkDk/5r7knzrissQNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057