UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6avITuW7XbCQrotRwyLyoK4jRw86BT3oWQe0EzWuLb8=' 
WHERE 
  key_id = 'd09da03d7474c1a4100d4a3bbb1547914134971381d7418a65ad5814480705fb' 
  AND (
    token = '6avITuW7XbCQrotRwyLyoK4jRw86BT3oWQe0EzWuLb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039