UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8pBu4ZRq0q1ipv2/MixBGLHSDRkgmq6U9owz26EqyVw=' 
WHERE 
  key_id = '161306869bcd8eac9637757aed57cde668c64f17628e61f7f8d9babb7a8343b5' 
  AND (
    token = '8pBu4ZRq0q1ipv2/MixBGLHSDRkgmq6U9owz26EqyVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039