UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zk1GuEI24qIQ6wYJC7mJdQgMdA/KKZetNQwlpaltbJ4=' 
WHERE 
  key_id = '300bac4bdafafee6f978dd598aad38d50c56be56f83281bb2000d625fff7c051' 
  AND (
    token = 'zk1GuEI24qIQ6wYJC7mJdQgMdA/KKZetNQwlpaltbJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050