UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YJfe9vRTDRm/BY4ZOTdxI76rtN5Jx5OjGRWBGAG1OrU=' 
WHERE 
  key_id = '1d32ebae9616ac8f68961619f23488d6f9a549e45e3b76df65c6a1e82be04f55' 
  AND (
    token = 'YJfe9vRTDRm/BY4ZOTdxI76rtN5Jx5OjGRWBGAG1OrU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035