UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P2ifAP3xdxlW/aKhHJaDrAhgyaKQPACTsho70AO8Jc8=' 
WHERE 
  key_id = '065304164c75df3bd6aa95d5379acfe18951108c3a112a8f0c0900b63d8aa946' 
  AND (
    token = 'P2ifAP3xdxlW/aKhHJaDrAhgyaKQPACTsho70AO8Jc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051