UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'udsvEt+8NVhXh7okns+KRKfP11E7OY8/4zpFPr15Sf0=' 
WHERE 
  key_id = '4b9c41d2aa80920f3f467c003e2c77a55c629be8021bd1922767cd068c0f3e63' 
  AND (
    token = 'udsvEt+8NVhXh7okns+KRKfP11E7OY8/4zpFPr15Sf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037