UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wy38YGwkTFu/+PjLtUVzTlkghZMYAvLH7NKR4E0ez+Y=' 
WHERE 
  key_id = 'ea9d5e262afdd781a999f3520ffd8843136da7a59c75239561f990cb0a95f768' 
  AND (
    token = 'Wy38YGwkTFu/+PjLtUVzTlkghZMYAvLH7NKR4E0ez+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031