UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aNT1Jl1HB1ydlw68QqqZRb/4MTaBiFI+ZUI2CZCKgtk=' 
WHERE 
  key_id = 'aff317ad4a7b4667eb5878e4b7367bd013d5bea7b021cb3d7b2465f6af2005f1' 
  AND (
    token = 'aNT1Jl1HB1ydlw68QqqZRb/4MTaBiFI+ZUI2CZCKgtk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029