UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pUXhpFXwuBmJK8tlOSSzvBEn0z6jxERqk12Y3B1+lX0=' 
WHERE 
  key_id = '7705b5e8820581713818c13fef49f001ea178479b61166ee84bec0751a578022' 
  AND (
    token = 'pUXhpFXwuBmJK8tlOSSzvBEn0z6jxERqk12Y3B1+lX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068