UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T+szemi2bJE7D38x4nL8DbfWJtbacTdRio9b2VPYgVg=' 
WHERE 
  key_id = '87e78b0bdb6d519e55974f1b9f7724824b04dc2d99ebdb3ac406c3c947a0b8af' 
  AND (
    token = 'T+szemi2bJE7D38x4nL8DbfWJtbacTdRio9b2VPYgVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033