UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tIFpCSSTSArU5nEDG6uG9CircBtYEhpJk2FZXySnFlg=' 
WHERE 
  key_id = 'b4667371ebde1debff0c5323a4487aeb0d81f050fd71f82a5ba8e22336afa790' 
  AND (
    token = 'tIFpCSSTSArU5nEDG6uG9CircBtYEhpJk2FZXySnFlg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021