UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yODgZZnzZw50IhpKjySjINdvIA70Mylp+9uGCdTcT3Q=' 
WHERE 
  key_id = '0ef0d150735010386b187e0cc58cbe35f223fc89468f51d206a68126fd9ec6cb' 
  AND (
    token = 'yODgZZnzZw50IhpKjySjINdvIA70Mylp+9uGCdTcT3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062