UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P3ZvxI6U8L3X5u28Xh2yAnk+OBFS9Eg706s/cidiSPQ=' 
WHERE 
  key_id = '5231783cf6a63e8a766a1f54bfc9c6ed4ae873dd5bf6fe7e74c64ccccac28e14' 
  AND (
    token = 'P3ZvxI6U8L3X5u28Xh2yAnk+OBFS9Eg706s/cidiSPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031